home *** CD-ROM | disk | FTP | other *** search
- var pNum = Number(this._name.slice(6,-3));
- var pX;
- var pY;
- var pState;
- var pSpd;
- var pLeftLimit;
- var pRightLimit;
- var pAnim;
- this.setUp = function(x, y, toleft, toright, spd)
- {
- var _loc1_ = this;
- _loc1_.pX = x * 16;
- _loc1_.pY = y * 16;
- _loc1_.pLeftLimit = _loc1_.pX - toleft * 16;
- _loc1_.pRightLimit = _loc1_.pX + toright * 16;
- _loc1_.pSpd = spd;
- _loc1_.pState = "active";
- _loc1_.pAnim = new Array(0,2);
- };
- this.onEnterFrame = function()
- {
- var _loc1_ = this;
- if(pState == "active")
- {
- pX += pSpd;
- if(pX > pRightLimit || pX < pLeftLimit)
- {
- pSpd = - pSpd;
- pX += pSpd;
- }
- if(pSpd < 0)
- {
- _loc1_._xscale = -100;
- }
- else
- {
- _loc1_._xscale = 100;
- }
- pAnim[0] = pAnim[0] + 1;
- if(pAnim[0] > 1)
- {
- pAnim[0] = 0;
- pAnim[1] = pAnim[1] + 1;
- if(pAnim[1] > 5)
- {
- pAnim[1] = 0;
- }
- _loc1_.gotoAndStop(pAnim[1] + 2);
- }
- if(Math.random() * 100 < 2)
- {
- if(_loc1_._parent["bullet" + pNum + "_mc"].pState == "idle")
- {
- _loc1_.fire();
- }
- }
- }
- else if(pState == "firing" || pState == "resting")
- {
- }
- };
- this.setPos = function(ty, tdir)
- {
- this._x = pX + 38;
- this._y = pY - ty;
- };
- this.fire = function()
- {
- pState = "firing";
- this.gotoAndPlay("shoot");
- };
- this.teaBreak = function()
- {
- pState = "resting";
- this.gotoAndPlay("sit");
- };
- this.resetMe = function()
- {
- var _loc1_ = this;
- switch(pNum)
- {
- case 0:
- _loc1_.setUp(10,23,9,17,4);
- break;
- case 1:
- _loc1_.setUp(34,41,6,4,3);
- break;
- case 2:
- _loc1_.setUp(25,53,1,16,4);
- break;
- case 3:
- _loc1_.setUp(30,92,10,10,-3);
- }
- };
- this.resetMe();
- stop();
-